import 'package:flutter/material.dart';
import 'package:lib_core/lib_core.dart';
import 'package:lib_ui/lib_ui.dart';

class TranslationPage extends CommonStatefulPage {
  @override
  List<Widget>? actions() {
    return null;
  }

  @override
  Widget body() {
    return SizedBox(
      width: Get.width,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text('当前语言:${Get.locale == const Locale('zh', 'CN') ? "中文" : "英文"}', style: LDFont.regular()),
          TextButton(
            onPressed: () {
              final currentLocale = Get.locale;
              if (currentLocale == const Locale('zh', 'CN')) {
                Get.updateLocale(const Locale('en', 'US'));
              } else {
                Get.updateLocale(const Locale('zh', 'CN'));
              }
            },
            child: const Text('切换语言'),
          ),
        ],
      ),
    );
  }

  @override
  Widget? leading() {
    return null;
  }

  @override
  String title() {
    return 'translationPageTitle'.tr;
  }
}
